<?php
namespace app\api\controller;
use app\common\BaseController;
use think\Db;

class Sn extends BaseController{    
    public function __construct(){
        parent::__construct();       
    }
    public function index(){   
        $params = $this->request->param();
        if(empty($params['type'])){
            return '缺少type参数';
        } 
        switch ($params['type'])
        {
        case 1:
            $str="T-";
            break;  
        case 2:
             $str = "S-";
             break;
        case 3:
             $str = "P-";
             break;
        case 4:
             $str = "D-";
             break;
        case 5:
             $str = "YE-";
             break;
        case 6:
            $str = "TE-";
             break;
        case 7:
            $str = "BE-";
            break;
        case 8:
            $str = "X-";
             break;
        case 9:
            $str = "F-";
            break;  
        case 10:
            $str = "Y-";
            break;            
        case 12:
            $str = "C-";
            break;         
        case 13:
            $str = "L-";
            break;     
        case 14:
            $str = "SM-";
            break;  
        case 15:
            $str = "OT-";
            break;   
        case 16:
            $str = "CT-";
            break;   
        case 17:
            $str = "CL-";
            break;   
        case 20:
            $str = "W-";
            break;     
        }
        return $str . date('Ymd') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);
    }   
}
